#!/usr/bin/env python# -*- coding: utf-8 -*-# @Time    : 2023/6/29 22:56# @Author  : zhaowp1109# @File    : exceptions.py# @Description :from fastapi.exceptions import (    HTTPException,    RequestValidationError,)from fastapi.requests import Requestfrom fastapi.responses import JSONResponseclass UnicornException(Exception):    def __init__(self, name: str):        self.name = nameasync def HttpExcHandle(_: Request, exc: HTTPException) -> JSONResponse:    content = dict(code=exc.status_code, msg=exc.detail, data=None)    return JSONResponse(content=content, status_code=exc.status_code)async def RequestValidationHandle(_: Request, exc: RequestValidationError) -> JSONResponse:    content = dict(code=422, msg=f"RequestValidationError, {exc}")    return JSONResponse(content=content, status_code=422)